package com.cq.hd.order.param;

import com.cq.hd.member.api.vo.*;
import com.cq.hd.order.po.TbOrderPo;
import lombok.Data;
import org.apache.commons.collections4.MapUtils;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * 订单结算参数
 *
 * @author much
 * @since 2024/05/06 21:17
 */
@Data
public class SettleParam {

    /**
     * 商家自有商户
     * key=merchantId, value=商家自有商户信息
     */
    private Map<Long, BusinessMerchantVo> businessMerchantVoMap;
    /**
     * 商户信息
     * key=merchantId, value=商户信息
     */
    private Map<Long, MerchantDetailVo> merchantMap;
    /**
     * 商家信息
     * key=businessId, value=商家信息
     */
    private Map<Long, BusinessDetailVo> businessMap;
    /**
     * 经纪人入驻列表
     * key=agentId, value=经纪人入驻列表
     */
    private Map<Long, List<AgentEnterApplyDetailVo>> agentEnterApplyDetailMap;
    /**
     * 经纪人信息
     * key=agentId, value=经纪人信息
     */
    private Map<Long, AppUserVo> agentUserMap;

    public BusinessDetailVo getBusiness(Long businessId) {
        if (MapUtils.isEmpty(businessMap)) {
            return null;
        }
        return businessMap.get(businessId);
    }

    public MerchantDetailVo getMerchant(Long merchantId) {
        if (MapUtils.isEmpty(merchantMap)) {
            return null;
        }
        return merchantMap.get(merchantId);
    }

    public BusinessMerchantVo getBusinessMerchant(Long merchantId) {
        if (MapUtils.isEmpty(businessMerchantVoMap)) {
            return null;
        }
        return businessMerchantVoMap.get(merchantId);
    }

    public List<AgentEnterApplyDetailVo> getAgentEnterApplies(Long agentId) {
        if (MapUtils.isEmpty(agentEnterApplyDetailMap)) {
            return Collections.emptyList();
        }
        return agentEnterApplyDetailMap.getOrDefault(agentId, Collections.emptyList());
    }

    public AppUserVo getAgent(Long agentId) {
        if (MapUtils.isEmpty(agentUserMap)) {
            return null;
        }
        return agentUserMap.get(agentId);
    }

}
